<?php
echo $javascript->codeBlock("
	$(document).ready(function(){
		copyDelivery($('#CustomerDeliveryAsBilling').attr('checked'));
		$('#CustomerDeliveryAsBilling').bind('change', function (event) {
			copyDelivery($(this).attr('checked'));
		});
	});
	
	$(function() {
		$( '#tabs' ).tabs();
	});
	
	function copyDelivery(checked){
		if(checked){
			$('#CustomerDeliveryName').attr({'value':$('#CustomerName').attr('value'),'disabled':'disabled'});			
			$('#CustomerDeliverySurname').attr({'value':$('#CustomerSurname').attr('value'),'disabled':'disabled'});
			$('#CustomerDeliveryAddress1').attr({'value':$('#CustomerAddress1').attr('value'),'disabled':'disabled'});
			$('#CustomerDeliveryAddress2').attr({'value':$('#CustomerAddress2').attr('value'),'disabled':'disabled'});
			$('#CustomerDeliveryAddress3').attr({'value':$('#CustomerAddress3').attr('value'),'disabled':'disabled'});
			$('#CustomerDeliveryAddress4').attr({'value':$('#CustomerAddress4').attr('value'),'disabled':'disabled'});
			$('#CustomerDeliveryAddress5').attr({'value':$('#CustomerAddress5').attr('value'),'disabled':'disabled'});
		}else{
			$('#CustomerDeliveryName').attr('disabled',false);
			$('#CustomerDeliverySurname').attr('disabled',false);
			$('#CustomerDeliveryAddress1').attr('disabled',false);
			$('#CustomerDeliveryAddress2').attr('disabled',false);
			$('#CustomerDeliveryAddress3').attr('disabled',false);
			$('#CustomerDeliveryAddress4').attr('disabled',false);
			$('#CustomerDeliveryAddress5').attr('disabled',false);
		}		
	}
",$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));
?>

<?php 
// wymagane w layout
echo $this->Section->main();
?>
<div class="content">
	<div id="left-column">
		<?php echo $this->element('left_column')?>		
	</div>
	<div class="right-store-column">
		<div  class="storeProducts">	
			<table width="100%" style="padding-top:0px; margin: 0px;" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="2" align="center"><h2><?php echo __('Account')?></h2></td>
			</tr>
			<tr>
				<td align="left" valign="top" style="padding-top:0px; margin: 0px;" width="50%">
					<?php echo $this->Form->create('User',array('url'=>array('plugin'=>false,'controller'=>'users','action'=>'account')));?>
					<div id="tabs">
						<ul>
							<li><a href="#tabs-1">Your Billing details</a></li>
							<li><a href="#tabs-2">Your Delivery details</a></li>
							<li><a href="#tabs-3">Change Password</a></li>
							<li><a href="#tabs-4">Orders</a></li>
							<li><a href="#tabs-5">Recently Viewed</a></li>
							<li><a href="#tabs-6">Favorite</a></li>
						</ul>
						<div id="tabs-1">
							<table width="100%" style="padding-top:0px; margin: 0px;" cellpadding="0" cellspacing="0">
								<tr>
									<td align="left" valign="top" style="padding-top:0px; margin: 0px;">
										<fieldset>
										<legend><h3><?php __d("store","Your Billing details below"); ?></h3></legend>
										<?php
											echo $this->Form->hidden('Customer.id');
											echo $this->Form->hidden('Customer.user_id');
											echo $this->Form->hidden('User.id');
											
											echo $this->Form->input('Customer.name',array('label'=>__d("store","First Name",true),'readonly'=>true));
											echo $this->Form->input('Customer.surname',array('label'=>__d("store","Surname",true),'readonly'=>true));
											echo $this->Form->input('Customer.address1',array('label'=>__d("store","Address",true)));
											echo $this->Form->input('Customer.address2',array('label'=>__d("store","Address",true)));
											echo $this->Form->input('Customer.address3',array('label'=>__d("store","City",true)));
											echo $this->Form->input('Customer.address4',array('label'=>__d("store","Zip Code",true)));
											echo $this->Form->input('Customer.address5',array('label'=>__d("store","Country",true),'options'=>$countrycod));
											echo $this->Form->input('User.email',array('label'=>__d("store","E-mail",true),'readonly'=>true));
										?>
										</fieldset>
									</td>
								</tr>
							</table>
						</div>
						<div id="tabs-2">
							<table width="100%" style="padding-top:0px; margin: 0px;" cellpadding="0" cellspacing="0">
								<tr>
									<td align="left" valign="top" style="padding-top:0px; margin: 0px;">										
										<fieldset>
									 		<legend><h3><?php __('Your Delivery details below'); ?></h3></legend>
									 		<div class="input text required">
												<label for="CustomerDeliveryAsBilling"><?php echo __d("store","Same as Billing Details?",true);?></label>
												<?php 
												echo $this->Form->checkbox('Customer.delivery_as_billing',array('hiddenField' => false)); 
												$this->Js->get('#CustomerDeliveryAsBilling');
												$this->Js->event( 'change', 'copyDelivery($("#CustomerDeliveryAsBilling").attr("checked"));' ,true);
												?>	
											</div>
										<?php									
											echo $this->Form->input('Customer.delivery_name',array('label'=>__d("store","First Name",true),'class'=>'delivery_files'));
											echo $this->Form->input('Customer.delivery_surname',array('label'=>__d("store","Surname",true),'class'=>'delivery_files'));
											echo $this->Form->input('Customer.delivery_address1',array('label'=>__d("store","Address",true),'class'=>'delivery_files'));
											echo $this->Form->input('Customer.delivery_address2',array('label'=>__d("store","Address",true),'class'=>'delivery_files'));
											echo $this->Form->input('Customer.delivery_address3',array('label'=>__d("store","City",true),'class'=>'delivery_files'));
											echo $this->Form->input('Customer.delivery_address4',array('label'=>__d("store","Zip Code",true),'class'=>'delivery_files'));
											echo $this->Form->input('Customer.delivery_address5',array('label'=>__d("store","Country",true),'class'=>'delivery_files','options'=>$countrycod));
										?>
										</fieldset>
									</td>
								</tr>
							</table>
						</div>
						<div id="tabs-3">
									<table width="100%" style="padding-top:0px; margin: 0px;" cellpadding="0" cellspacing="0">
										<tr>
											<td align="left" valign="top" style="padding-top:0px; margin: 0px;">
												<fieldset>
												<legend><h3><?php __d("store","Change Your Password below"); ?></h3></legend>
												<p>If you would like to change your password please enter your existing password, then your new password and submit your request.</p>
												<?php													
													echo $this->Form->input('User.old_password',array('label'=>__d("store","Please enter your current password",true),'type'=>'password'));
													echo $this->Form->input('User.new_password',array('label'=>__d("store","Please enter a new password",true),'type'=>'password'));
												?>
												</fieldset>
											</td>
						
										</tr>
									</table>
						</div>
						<div id="tabs-4">
							<table width="100%" style="padding-top:0px; margin: 0px; height: 100px;" cellpadding="0" cellspacing="0">
								<tr>
									<td align="left" valign="middle" style="padding-top:0px; margin: 0px;">
										<?php echo $html->link($html->image(HOST.'/orders.png',array('align'=>'middle')).' - '.__('Click here to display Yours orders.',true),
											array('plugin'=>'store','controller'=>'orders','action'=>'account',$this->data['User']['id']),array('escape'=>false)) ?>
									</td>						
								</tr>
							</table>
						</div>
						<div id="tabs-5">
							<table width="100%" style="padding-top:0px; margin: 0px; height: 100px;" cellpadding="0" cellspacing="0">
								<tr>
									<td align="left" valign="middle" style="padding-top:0px; margin: 0px;">
										<?php echo $html->link($html->image(HOST.'/history.png',array('align'=>'middle')).' - '.__('Click here to display recently wiewed articles',true),
											array('plugin'=>'store','controller'=>'products','action'=>'recently'),array('escape'=>false)) ?>
									</td>						
								</tr>
							</table>
						</div>
						<div id="tabs-6">
							<table width="100%" style="padding-top:0px; margin: 0px; height: 100px;" cellpadding="0" cellspacing="0">
								<tr>
									<td align="left" valign="middle" style="padding-top:0px; margin: 0px;">
										<?php echo $html->link($html->image(HOST.'/favorite.png',array('align'=>'middle')).' - '.__('Click here to display recently wiewed articles',true),
											array('plugin'=>'store','controller'=>'products','action'=>'favorite'),array('escape'=>false)) ?>
									</td>						
								</tr>
							</table>
						</div>
					</div>
					<input type="image" src="/img/store.moon/buttons_submit.png" style="border: none; padding: 0px; margin: 4px;" />
					<?php echo $this->Form->end();?>
				</td>
			</tr>

			</table>
		</div>
	</div>
</div>







